﻿using System;
using Microsoft.Extensions.Localization;
using Thinker.SignChannel.Times;

namespace Thinker.SignChannel.Dto;

public static class DisplayExtensions
{
    public static string ToDisplay(this Direction direction, IStringLocalizer localizer)
    {
        return direction switch
        {
            Direction.In => localizer["Direction:In"],
            Direction.Out => localizer["Direction:Out"],
            _ => throw new ArgumentOutOfRangeException(nameof(direction), direction, null)
        };
    }

    public static string ToDisplay(this DateOnly value)
    {
        return value.ToString(SignChannelConsts.DateFormat);
    }

    public static string ToDisplay(this DateTime value)
    {
        return value.ToString(SignChannelConsts.DateTimeFormat);
    }

    public static string ToDisplayOnlyTime(this DateTime value)
    {
        return value.ToString(SignChannelConsts.TimeFormat);
    }
}